package repository

import "common/db"

type DbManager struct {
	Mongo *db.MongoManager
	Redis *db.RedisManager
}

func New() *DbManager {
	return &DbManager{
		Mongo: db.NewMongoManager(),
		Redis: db.NewRedisManager(),
	}
}

// Close 关闭数据库连接
func (m DbManager) Close() {
	if m.Mongo != nil {
		m.Mongo.Close()
	}
	if m.Redis != nil {
		m.Redis.Close()
	}
}
